package com.example.satoken.config;

import cn.dev33.satoken.stp.StpInterface;
import com.example.satoken.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chenhh
 * @version v1.0
 * @date 2025/5/12 17:15
 */
@Component
public class StpInterfaceImpl implements StpInterface {

    @Resource
    private SysUserMapper userMapper;
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return userMapper.selectMenuPermsByUserId(Long.parseLong(loginId.toString()));
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return userMapper.selectRoleKeysByUserId(Long.parseLong(loginId.toString()));
    }
}
